package jp.heartdokyun.activity;

import jp.heartdokyun.R;
import jp.heartdokyun.listener.TopBackListener;
import jp.heartdokyun.util.Utils;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.TextView;

public class HelpActivity extends Activity {
	private MediaPlayer mMediaPlayer;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.help);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		ImageButton ibo = (ImageButton) findViewById(R.id.ic_o);
		ibo.setOnClickListener(new TopBackListener(this));
		
		ImageButton ibMenu = (ImageButton) findViewById(R.id.ib_ghoubimorau);
		ibMenu.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View arg0) {
				Intent itMenu = new Intent(HelpActivity.this,MenuActivity.class);
					startActivity(itMenu);
			}
		});
		
		
	}
	@Override
	public void onDestroy() {
		if (mMediaPlayer != null)
			mMediaPlayer.release();
		super.onDestroy();
	}

	@Override
	public void onResume() {


		if (MainActivity.isEnableBGM) {
			mMediaPlayer = MediaPlayer.create(getApplicationContext(),
					R.raw.other_bgm);
			float volume = Utils.getBGMVolume(getApplicationContext());
			mMediaPlayer.setVolume(volume, volume);
			mMediaPlayer.setLooping(true);
			mMediaPlayer.start();
		}
		super.onResume();
	}

	@Override
	public void onPause() {
		// if (mMediaPlayer.isPlaying()) {
		// mMediaPlayer.pause();
		// mMediaPlayer.seekTo(0);
		// }
		if (mMediaPlayer != null)
			mMediaPlayer.release();
		super.onPause();
	}
}
